<load file="__PUBLIC__/header.html"/>
<ul class="top_title">
    <li>
        <p class="menu_title">检索结果</p>
    </li>
    <li>|</li>
    <li>
        <a href="__CONTROL__/addInfo" class="menu_title_a" >
            <i class="icon icon-plus-sign"></i>&nbsp;添加内容
        </a>
    </li>
    <li>  &nbsp;|</li>
    <li class="menu_title">分类筛选:</li>
    <li>
        <form action="__URL__" method="post" >
            <ul>
                <li>&nbsp;&nbsp;&nbsp;&nbsp;
                    <select name='listTitle' id='listTitle'>
                        {$fenlei}
                    </select>
                </li>
                <li> |</li>
                
                <li class="menu_title">排序方式:</li>
                <li>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <select name='sort' id='sort'>
                        <option value='addtime' <?php if($_GET['sort']=='addtime') echo "selected='selected'";?>>发表日期</option>
                        <option value='id' <?php if($_GET['sort']=='id') echo "selected='selected'";?>>ID</option>

                    </select>
                </li>
            </ul>

        </form>    

    </li>
    
  
</ul>

    <table class="table">
        <thead>
            <tr class="top_channel">
                <th align="center" width="60">文章ID</th>
                <th width='20'></th>
                <th align="center" width="26%">标题</th>
                <th align='center' width='88'>所属分类</th>
                <th align='center' width='88'>发表日期</th>
                <th align='center' width='130'>是否使用</th>
                <th align="center">操作</th>
            </tr>
        </thead>
        <tbody>
      

        <foreach from="$list" value="$v">
            <tr class="top_channel">
           
                <td align="center">
                    <input type="text" disabled="disabled" value="{$v.id}"  class="input-medium"/>
                </td>
                <td width='20'></td>
                <td align="center" class="dis">
                  <a href="__CONTROL__/editInfo?id={$v.id}"> {$v.title}</a>
                </td>
               <td align='center'>{$v.lname}</td>
                
               <td align='center'>{$v.addtime|date:"Y-m-d H:i:s",@@}</td>
               <td align='center'>
                  
                   <if value="$v['isshow'] ==1">
                        <span class="btn isshow" id='{$v.id}' style='color:#888'  zt='{$v.isshow}' >使用</span>
                        <else/>
                        <span class="btn isshow" id='{$v.id}' style='color:#f60'  zt='{$v.isshow}' >禁止</span>

                    </if>
                    
                    <if value="$v['istop'] == 1">|<span style="color:#f60;">已置顶</span></if>
               </td>

                <td align="center">
                
                    <a href="__CONTROL__/editInfo?id={$v.id}" class="isok btn edit">

                        <i class="icon icon-edit"></i>&nbsp;编辑
                    </a>
                    | <a href="__CONTROL__/delInfo?id={$v.id}" class="isok btn del">
                      
                        <i class="icon icon-trash"></i>&nbsp;删除
                    </a>
                </td>
            </tr>
        </foreach>

            <tr class="top_channel">
                <td></td>
                <td align="center">
                    
                </td>
                <td colspan="5">{$page} </td>
            </tr>
        </tbody>
    </table>
    <script type='text/javascript'>
    $(function(){
            $('.del').click(function(){
            var cn = confirm('确定删除吗？');
            if(!cn){
                return false;
            }
            });


            var METH = '__METH__';
            var ROOT = '__URL__';
        //分类筛选
        $('#listTitle').change(function(){
            //alert($(this).val());
            location.href=ROOT+'/fenlei/'+$(this).val();
            exit(0);
        });
        $('#sort').change(function(){//排序

            location.href=ROOT+'/sort/'+$(this).val();
            exit(0);
        });

        //内容异步使用禁止
         $('.isshow').live('click',function(){
            var id = $(this).attr('id');
            var zt = $(this).attr('zt');
            zt = zt=='1'?'2':'1';
            ajaxChange(id,zt);

         });

    });



    function ajaxChange(id,zt){
          
             $.post('__CONTROL__/'+'ajaxInfoShow',{'id':id,'zt':zt},function(data){
               if(data.id){//返回真，更新成功，修改前台css显示
                  if(data.isshow=='1'){
                      $('#'+data.id).css('color','#888').attr('zt',data.isshow).html('使用');
                  }else{
                      $('#'+data.id).css('color','#f60').attr('zt',data.isshow).html('禁止');
                  }
                  
                
               }else{
                  alert('出错了');
               }
            },"json");
        
    }

    </script>

</body>
</html>